package com.example.ktapplication.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.example.ktapplication.R
import com.example.ktapplication.base.TabViewpagerFragment
import com.example.ktapplication.model.SystemViewModel
import com.google.android.material.tabs.TabLayout

class VideoTabFragment : TabViewpagerFragment() {

    private val viewModel by lazy {
        ViewModelProvider(this)[SystemViewModel::class.java]
    }

    private val pages by lazy {
        mutableMapOf<String, Fragment>().apply {
            put("音乐", MusicListFragment())
            put("视频", VideoListFragment())
        }
    }

    override fun onDate(savedInstanceState: Bundle?) {
    }

    override fun onViewBing() {
        super.onViewBing()
        binding.tabLayout.setBackgroundColor(resources.getColor(R.color.color_f2))
        binding.tabLayout.tabMode = TabLayout.MODE_FIXED //子项平分宽度
        setupViewPager(pages.toList())
    }

    override fun loadData() {
        viewModel.getProject()
    }

}